package com.acegear.horizon.controllers;

import com.acegear.horizon.controllers.vo.ResultVO;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by wangsike on 2016/12/17.
 */
@RestControllerAdvice
public class ExceptionHandleController {

    @ExceptionHandler(Throwable.class)
    @ResponseBody
    public ResultVO error(Throwable t) {
        t.printStackTrace();
        return ResultVO.error(t.getMessage(), 999);
    }
}
